package mensa_main;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;

import mensa.member.MemberDTO;
import component.IconJButton;
import component.JPanelTranslucencyAndRadian;

public class PanelCellRenderer extends JPanel implements ListCellRenderer{

	private static final long serialVersionUID = 1L;
	
	private MemberDTO member;
	private JPanelTranslucencyAndRadian panel_west,panel_left_gap,panel_right_gap;
	int i = 0;
	private JLabel label;

	public PanelCellRenderer(){
		this.setLayout(new BorderLayout());
		this.panel_west = new JPanelTranslucencyAndRadian(new BorderLayout());
		this.panel_left_gap = new JPanelTranslucencyAndRadian(10,0);
		this.panel_right_gap = new JPanelTranslucencyAndRadian(10,0);
		this.add("West", this.panel_west);
		this.setOpaque(false);
		this.panel_west.add("West",this.panel_left_gap);
		//this.panel_left_gap.setBorder(BorderFactory.createLineBorder(Color.BLUE));
		this.panel_west.add("Center",new IconJButton("resource/icon/mensa_chat/","buddy_profile_default"));
		//this.panel_west.add("Center",new JButton("aa"));
		this.panel_west.add("East",this.panel_right_gap);
		//this.panel_right_gap.setBorder(BorderFactory.createLineBorder(Color.RED));
		this.label = new JLabel();
		this.add("Center",this.label);
		
	}

	@Override
	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
		MemberDTO member = (MemberDTO)value;
		this.label.setText(member.getId());
		
		return this;
	}
	
}
